<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>csymm.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CSYMM.1"></a><a href="csymm.f.html#CSYMM.1">CSYMM</a>(SIDE,UPLO,M,N,ALPHA,A,LDA,B,LDB,BETA,C,LDC)
<span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      COMPLEX ALPHA,BETA
      INTEGER LDA,LDB,LDC,M,N
      CHARACTER SIDE,UPLO
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX A(LDA,*),B(LDB,*),C(LDC,*)
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CSYMM.14"></a><a href="csymm.f.html#CSYMM.1">CSYMM</a>  performs one of the matrix-matrix operations
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     C := alpha*A*B + beta*C,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  or
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     C := alpha*B*A + beta*C,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where  alpha and beta are scalars, A is a symmetric matrix and  B and
</span><span class="comment">*</span><span class="comment">  C are m by n matrices.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  ==========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SIDE   - CHARACTER*1.
</span><span class="comment">*</span><span class="comment">           On entry,  SIDE  specifies whether  the  symmetric matrix  A
</span><span class="comment">*</span><span class="comment">           appears on the  left or right  in the  operation as follows:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              SIDE = 'L' or 'l'   C := alpha*A*B + beta*C,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              SIDE = 'R' or 'r'   C := alpha*B*A + beta*C,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  UPLO   - CHARACTER*1.
</span><span class="comment">*</span><span class="comment">           On  entry,   UPLO  specifies  whether  the  upper  or  lower
</span><span class="comment">*</span><span class="comment">           triangular  part  of  the  symmetric  matrix   A  is  to  be
</span><span class="comment">*</span><span class="comment">           referenced as follows:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              UPLO = 'U' or 'u'   Only the upper triangular part of the
</span><span class="comment">*</span><span class="comment">                                  symmetric matrix is to be referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              UPLO = 'L' or 'l'   Only the lower triangular part of the
</span><span class="comment">*</span><span class="comment">                                  symmetric matrix is to be referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M      - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry,  M  specifies the number of rows of the matrix  C.
</span><span class="comment">*</span><span class="comment">           M  must be at least zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N      - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, N specifies the number of columns of the matrix C.
</span><span class="comment">*</span><span class="comment">           N  must be at least zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ALPHA  - COMPLEX         .
</span><span class="comment">*</span><span class="comment">           On entry, ALPHA specifies the scalar alpha.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A      - COMPLEX          array of DIMENSION ( LDA, ka ), where ka is
</span><span class="comment">*</span><span class="comment">           m  when  SIDE = 'L' or 'l'  and is n  otherwise.
</span><span class="comment">*</span><span class="comment">           Before entry  with  SIDE = 'L' or 'l',  the  m by m  part of
</span><span class="comment">*</span><span class="comment">           the array  A  must contain the  symmetric matrix,  such that
</span><span class="comment">*</span><span class="comment">           when  UPLO = 'U' or 'u', the leading m by m upper triangular
</span><span class="comment">*</span><span class="comment">           part of the array  A  must contain the upper triangular part
</span><span class="comment">*</span><span class="comment">           of the  symmetric matrix and the  strictly  lower triangular
</span><span class="comment">*</span><span class="comment">           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
</span><span class="comment">*</span><span class="comment">           the leading  m by m  lower triangular part  of the  array  A
</span><span class="comment">*</span><span class="comment">           must  contain  the  lower triangular part  of the  symmetric
</span><span class="comment">*</span><span class="comment">           matrix and the  strictly upper triangular part of  A  is not
</span><span class="comment">*</span><span class="comment">           referenced.
</span><span class="comment">*</span><span class="comment">           Before entry  with  SIDE = 'R' or 'r',  the  n by n  part of
</span><span class="comment">*</span><span class="comment">           the array  A  must contain the  symmetric matrix,  such that
</span><span class="comment">*</span><span class="comment">           when  UPLO = 'U' or 'u', the leading n by n upper triangular
</span><span class="comment">*</span><span class="comment">           part of the array  A  must contain the upper triangular part
</span><span class="comment">*</span><span class="comment">           of the  symmetric matrix and the  strictly  lower triangular
</span><span class="comment">*</span><span class="comment">           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
</span><span class="comment">*</span><span class="comment">           the leading  n by n  lower triangular part  of the  array  A
</span><span class="comment">*</span><span class="comment">           must  contain  the  lower triangular part  of the  symmetric
</span><span class="comment">*</span><span class="comment">           matrix and the  strictly upper triangular part of  A  is not
</span><span class="comment">*</span><span class="comment">           referenced.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDA    - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, LDA specifies the first dimension of A as declared
</span><span class="comment">*</span><span class="comment">           in the  calling (sub) program. When  SIDE = 'L' or 'l'  then
</span><span class="comment">*</span><span class="comment">           LDA must be at least  max( 1, m ), otherwise  LDA must be at
</span><span class="comment">*</span><span class="comment">           least max( 1, n ).
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  B      - COMPLEX          array of DIMENSION ( LDB, n ).
</span><span class="comment">*</span><span class="comment">           Before entry, the leading  m by n part of the array  B  must
</span><span class="comment">*</span><span class="comment">           contain the matrix B.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDB    - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, LDB specifies the first dimension of B as declared
</span><span class="comment">*</span><span class="comment">           in  the  calling  (sub)  program.   LDB  must  be  at  least
</span><span class="comment">*</span><span class="comment">           max( 1, m ).
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  BETA   - COMPLEX         .
</span><span class="comment">*</span><span class="comment">           On entry,  BETA  specifies the scalar  beta.  When  BETA  is
</span><span class="comment">*</span><span class="comment">           supplied as zero then C need not be set on input.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  C      - COMPLEX          array of DIMENSION ( LDC, n ).
</span><span class="comment">*</span><span class="comment">           Before entry, the leading  m by n  part of the array  C must
</span><span class="comment">*</span><span class="comment">           contain the matrix  C,  except when  beta  is zero, in which
</span><span class="comment">*</span><span class="comment">           case C need not be set on entry.
</span><span class="comment">*</span><span class="comment">           On exit, the array  C  is overwritten by the  m by n updated
</span><span class="comment">*</span><span class="comment">           matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDC    - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, LDC specifies the first dimension of C as declared
</span><span class="comment">*</span><span class="comment">           in  the  calling  (sub)  program.   LDC  must  be  at  least
</span><span class="comment">*</span><span class="comment">           max( 1, m ).
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Level 3 Blas routine.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- Written on 8-February-1989.
</span><span class="comment">*</span><span class="comment">     Jack Dongarra, Argonne National Laboratory.
</span><span class="comment">*</span><span class="comment">     Iain Duff, AERE Harwell.
</span><span class="comment">*</span><span class="comment">     Jeremy Du Croz, Numerical Algorithms Group Ltd.
</span><span class="comment">*</span><span class="comment">     Sven Hammarling, Numerical Algorithms Group Ltd.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL <a name="LSAME.136"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL <a name="LSAME.137"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL <a name="XERBLA.140"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC MAX
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      COMPLEX TEMP1,TEMP2
      INTEGER I,INFO,J,K,NROWA
      LOGICAL UPPER
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX ONE
      PARAMETER (ONE= (1.0E+0,0.0E+0))
      COMPLEX ZERO
      PARAMETER (ZERO= (0.0E+0,0.0E+0))
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Set NROWA as the number of rows of A.
</span><span class="comment">*</span><span class="comment">
</span>      IF (<a name="LSAME.159"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(SIDE,<span class="string">'L'</span>)) THEN
          NROWA = M
      ELSE
          NROWA = N
      END IF
      UPPER = <a name="LSAME.164"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(UPLO,<span class="string">'U'</span>)
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF ((.NOT.<a name="LSAME.169"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(SIDE,<span class="string">'L'</span>)) .AND. (.NOT.<a name="LSAME.169"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(SIDE,<span class="string">'R'</span>))) THEN
          INFO = 1
      ELSE IF ((.NOT.UPPER) .AND. (.NOT.<a name="LSAME.171"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(UPLO,<span class="string">'L'</span>))) THEN
          INFO = 2
      ELSE IF (M.LT.0) THEN
          INFO = 3
      ELSE IF (N.LT.0) THEN
          INFO = 4
      ELSE IF (LDA.LT.MAX(1,NROWA)) THEN
          INFO = 7
      ELSE IF (LDB.LT.MAX(1,M)) THEN
          INFO = 9
      ELSE IF (LDC.LT.MAX(1,M)) THEN
          INFO = 12
      END IF
      IF (INFO.NE.0) THEN
          CALL <a name="XERBLA.185"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>(<span class="string">'<a name="CSYMM.185"></a><a href="csymm.f.html#CSYMM.1">CSYMM</a> '</span>,INFO)
          RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible.
</span><span class="comment">*</span><span class="comment">
</span>      IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
     +    ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     And when  alpha.eq.zero.
</span><span class="comment">*</span><span class="comment">
</span>      IF (ALPHA.EQ.ZERO) THEN
          IF (BETA.EQ.ZERO) THEN
              DO 20 J = 1,N
                  DO 10 I = 1,M
                      C(I,J) = ZERO
   10             CONTINUE
   20         CONTINUE
          ELSE
              DO 40 J = 1,N
                  DO 30 I = 1,M
                      C(I,J) = BETA*C(I,J)
   30             CONTINUE
   40         CONTINUE
          END IF
          RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Start the operations.
</span><span class="comment">*</span><span class="comment">
</span>      IF (<a name="LSAME.215"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(SIDE,<span class="string">'L'</span>)) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Form  C := alpha*A*B + beta*C.
</span><span class="comment">*</span><span class="comment">
</span>          IF (UPPER) THEN
              DO 70 J = 1,N
                  DO 60 I = 1,M
                      TEMP1 = ALPHA*B(I,J)
                      TEMP2 = ZERO
                      DO 50 K = 1,I - 1
                          C(K,J) = C(K,J) + TEMP1*A(K,I)
                          TEMP2 = TEMP2 + B(K,J)*A(K,I)
   50                 CONTINUE
                      IF (BETA.EQ.ZERO) THEN
                          C(I,J) = TEMP1*A(I,I) + ALPHA*TEMP2
                      ELSE
                          C(I,J) = BETA*C(I,J) + TEMP1*A(I,I) +
     +                             ALPHA*TEMP2
                      END IF
   60             CONTINUE
   70         CONTINUE
          ELSE
              DO 100 J = 1,N
                  DO 90 I = M,1,-1
                      TEMP1 = ALPHA*B(I,J)
                      TEMP2 = ZERO
                      DO 80 K = I + 1,M
                          C(K,J) = C(K,J) + TEMP1*A(K,I)
                          TEMP2 = TEMP2 + B(K,J)*A(K,I)
   80                 CONTINUE
                      IF (BETA.EQ.ZERO) THEN
                          C(I,J) = TEMP1*A(I,I) + ALPHA*TEMP2
                      ELSE
                          C(I,J) = BETA*C(I,J) + TEMP1*A(I,I) +
     +                             ALPHA*TEMP2
                      END IF
   90             CONTINUE
  100         CONTINUE
          END IF
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Form  C := alpha*B*A + beta*C.
</span><span class="comment">*</span><span class="comment">
</span>          DO 170 J = 1,N
              TEMP1 = ALPHA*A(J,J)
              IF (BETA.EQ.ZERO) THEN
                  DO 110 I = 1,M
                      C(I,J) = TEMP1*B(I,J)
  110             CONTINUE
              ELSE
                  DO 120 I = 1,M
                      C(I,J) = BETA*C(I,J) + TEMP1*B(I,J)
  120             CONTINUE
              END IF
              DO 140 K = 1,J - 1
                  IF (UPPER) THEN
                      TEMP1 = ALPHA*A(K,J)
                  ELSE
                      TEMP1 = ALPHA*A(J,K)
                  END IF
                  DO 130 I = 1,M
                      C(I,J) = C(I,J) + TEMP1*B(I,K)
  130             CONTINUE
  140         CONTINUE
              DO 160 K = J + 1,N
                  IF (UPPER) THEN
                      TEMP1 = ALPHA*A(J,K)
                  ELSE
                      TEMP1 = ALPHA*A(K,J)
                  END IF
                  DO 150 I = 1,M
                      C(I,J) = C(I,J) + TEMP1*B(I,K)
  150             CONTINUE
  160         CONTINUE
  170     CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CSYMM.294"></a><a href="csymm.f.html#CSYMM.1">CSYMM</a> .
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
